package com.zsrd.system.util;

import cn.hutool.core.lang.UUID;
import cn.hutool.crypto.SecureUtil;
import com.zsrd.auth.domain.dto.LoginDto;

import java.util.Random;

public  class RandomPassword {

    public static void main(String[] args) {

//        LoginDto loginDto = new LoginDto();
//        loginDto.setPassword("11112");
//
//        String s = SecureUtil.sha256(loginDto.getPassword());
//        System.out.println(s);

        System.out.println(card());
    }

    //随机不重复的6-8位
    public static String card(){
        int[] array = {0,1,2,3,4,5,6,7,8,9};
        Random rand = new Random();
        for (int i = 10; i > 1; i--) {
            int index = rand.nextInt(i);
            int tmp = array[index];
            array[index] = array[i - 1];
            array[i - 1] = tmp;
        }
        int result = 0;
        for(int i = 0; i < 6; i++){
            result = result * 10 + array[i];
        }
        return String.valueOf(result);
    }


}
